#encoding:utf-8
'''
Created on 2012/2/27

@author: Netdb_Heng
'''
#參數一為母體，參數二為輸入Label，參數三為輸出sample，參數四為輸出sample的class，參數五為筆數

import sys

print ( sys.argv[1] + " to " + sys.argv[3] )

data_inf = open(sys.argv[1])
noiseData_inf = open(sys.argv[2])

outf = open(sys.argv[3],'w')

data_lines = data_inf.readlines()
noiseData_lines = noiseData_inf.readlines()

outf.write(data_lines[0])
instance=0

for i in range(1,len(data_lines)):
    noiseData = noiseData_lines[i].split()
    if(float(noiseData[2])==0.0):
        outf.write(data_lines[i])
        instance+=1
print("instance : " + str(instance))

       
data_inf.close();
outf.close();

